package com.dr.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dr.common.MD5Util;
import com.dr.mapper.UserMapper;
import com.dr.pojo.User;
import com.dr.service.UserService;

@Service
@Transactional
public class UserServiceImpl implements UserService {
	@Autowired
	private UserMapper mapper;
	
	@Override
	public List<User> findUserList() {
		return mapper.findUserList();
	}
	@Override
	public List<User> findUserListByName(String userName) {
		return mapper.findUserListByName(userName);
	}
	@Override
	public User findUserByName(String userName) {
		return mapper.findUserByName(userName);
	}

	@Override
	public User findUserById(String id) {
		return mapper.findUserById(id);
	}

	@Override
	public int insertUser(User user) {		
		return mapper.insertUser(user);
	}
	@Override
	public int updateUser(User user) {
		return mapper.updateUser(user);
	}

	@Override
	public int updatePassword(User user) {
		
		user.setPassword(MD5Util.md5(user.getPassword()));
		return mapper.updatePassword(user);
	}

	@Override
	public int deletetUser(String[] id) {
		return mapper.deletetUser(id);
	}

}
